   //初始化订单一级表格
   function initOrderJqgrid(){
	   initFind_Orderdatepicker();
	    initSeeOrderInfo();
		initShowreturnInfo();
		initDialog();
		initAutocomplete();
	   //$("#list1").tableDnD({scrollAmount:0}); 
	   initFind_DeliverAutocomplete();
	   initSpecifyOrderDialog();
	  
	 	  <!--初始化送货员表格-->
		initsonghuyuan();
		$( "button").button();
		initfindOrder();
     $("#list1").jqGrid({
   	url:'../orderHandle/queryMainOrder.jsp',
	datatype: "xml",//
   	colNames:['订单ID','订单总交易额','用户支付金额','订单添加时间','客户', '送货员','送货路线','订单状态','备注','删除'],
   	colModel:[
		{name:'Order_ID', width:100, sortable:false},
   		{name:'Order_Total_Price',index:'Order_Total_Price', width:75},
		{name:'Payment_Price',index:'Payment_Price',editable:true, width:75},
   		{name:'Order_AddTime',index:'Order_AddTime',align:"center", width:150},
		{name:'User_ID', width:75,align:"center",sortable:false},
   		{name:'Deliver_ID', width:75, align:"center",sortable:false},
		{name:'Deliver_Path_ID', width:100,sortable:false },
   		{name:'Order_Status', width:80, align:"center",sortable:false,formatter:Fmatter_Order_Status},
		{name:'Info', width:80, align:"center",sortable:false,formatter:Fmatter_Order_Info},
		{name:'del', width:80, align:"center",sortable:false,formatter:FmatterDel},
   	],
	//scroll: true,
   	rowNum:15,
   	autowidth: true,
	height:400,
   	rowList:[10,20,30],
	prmNames:{page:'page',rows:'rows',order: 'sord', search:'_search', nd:'nd', npage:null},
	postData:{page:'page',rows:'rows', sort: 'sidx',order: 'sordsdf'},
   	pager: jQuery('#pager1'),
	loadCompele: $( "button").button(),
	loadError:   function(xhr,stu,e){alert(xhr.responseText);},
   	sortname: 'Order_AddTime',
    viewrecords: true,
    sortorder: "desc",
    caption:"XML Example",	
	forceFit : true, 
	cellEdit: true,
	cellsubmit: 'clientArray',
	afterEditCell: function (id,name,val,iRow,iCol){
	
	},
	afterSaveCell : function(rowid,name,val,iRow,iCol) {
		  var myrow = jQuery(this).jqGrid('getRowData',rowid);
		
		ModifyPayment_Price(myrow.Order_ID,myrow.Payment_Price);
	},
	
	onSelectRow: function(id){    
      
   },   
	gridComplete: function() {
    	$( "button").button();
    }, 
	//此事件在点击表格特定单元格时发生。rowid 为行ID；iCol 为列索引；cellcontent 为单元格中内容；e 点击事件对象
	onCellSelect:function(rowid,iCol,cellcontent,e){
		if(iCol==7){
			if($(cellcontent).text()=='派送'){
				var myrow = jQuery('#list1').jqGrid('getRowData',rowid);
				specify_Event(myrow.Order_ID);
				}else if($(cellcontent).text()=='下单'){
					var aa= window.confirm("是否确认下单?");
			if (aa) {
		        var myrow = jQuery('#list1').jqGrid('getRowData',rowid);
				Sure_Order(myrow.User_ID,myrow.Order_ID);
			}
					}
					
			//delUser(myrow.User_ID);
			}else if(iCol==9){
				var aa= window.confirm("是否确认删除定单?");
			if (aa) {
		       var myrow = jQuery('#list1').jqGrid('getRowData',rowid);
				delOrder(myrow.Order_ID)
			}
				}
		},
	editurl:"../userHandle/editUser.jsp",
	subGrid : true,
     subGridRowExpanded: function (subgrid_id, row_id){SubGridOrder(subgrid_id, row_id) },
         
}).navGrid('#pager1',{edit:false,add:false,del:false,search: false }).navButtonAdd('#pager1',{   
   caption:"添加",    
   buttonicon:"ui-icon-add",    
   onClickButton: function(){    
    $('#AddOrder-form').dialog('open').children('form')[0].reset();  
   },    

   position:"last"  
});	
//jQuery("#list1").jqGrid('inlineNav',"#pager1");
	   }
	   //通过订单表的行ID获取订单ID
	   function getOrder_ID_By_Row(rowid){
		   var myrow = jQuery('#list1').jqGrid('getRowData',rowid);
			return myrow.Order_ID;
		   }
	   
	   //订单表格的二级表格初始化
	   function SubGridOrder(subgrid_id, row_id){    
	  var Order_ID= getOrder_ID_By_Row(row_id);
	  //alert("subgrid_id="+subgrid_id+" row_id="+row_id+" Order_ID="+Order_ID);
         var subgrid_table_id; 
		 pager_id = "p_"+subgrid_table_id;
         jQuery("#"+subgrid_id).html("<table id='" + subgrid_table_id + "' class='scroll'></table><div id='"+pager_id+"' class='scroll'></div>"); 
         jQuery("#"+subgrid_table_id).jqGrid({      
            url: '../orderHandle/queryProductOrder.jsp?Order_ID='+Order_ID, //获取数据
            datatype: "xml", 
			viewrecords: true,
			pager:jQuery("#"+pager_id),
            mtype: 'POST',
			cellEdit: true,
			cellsubmit: 'clientArray',
            colNames: ['产品ID','产品名称','产品销售价格','购买产品数量','产品销售总额'], 
            colModel: [ 
             {name:"Order_Products", width:100,sortable:false}, 
             {name:"Product_Name",width:130, sortable:false}, 
             {name:"Product_Sale_Price",width:80,align:"left", sortable:false}, 
             {name:"Product_Num",width:80,align:"left",editable:true,sortable:false},
			 {name:"Order_Total_Price",width:80,align:"left",sortable:false}, 
              ], 
			afterSaveCell : function(rowid,name,val,iRow,iCol) {
				 var id = jQuery("#list1").jqGrid('getGridParam','selrow');   
	  if (id) {   
	  var ret = jQuery("#list1").jqGrid('getRowData',id);  
	  var myrow = jQuery('#'+subgrid_table_id).jqGrid('getRowData',rowid);
		
		ModifyOrderProduct(ret.Order_ID,myrow.Order_Products,name+"="+val);
	   
	  } else {
		  alert("请选择这个订单！");
		  }
			},
            rowNum: 20, 
            imgpath: 'images图片URL', 
            sortname: 'Order_Products', 
            sortorder: "asc" }).navGrid("#"+pager_id,{edit:false,add:false,del:false,search: false }).navButtonAdd("#"+pager_id,{   
   caption:"添加",    
   buttonicon:"ui-icon-add",    
   onClickButton: function(){    
 	 var id = jQuery("#list1").jqGrid('getGridParam','selrow');   
	  if (id) {   
	  var ret = jQuery("#list1").jqGrid('getRowData',id);  
	   $('#AddOrderProduct-form').dialog('open').children('form')[0].reset();  
	   $('#Add_OrderProduct_OrderID').val(ret.Order_ID);  
	   $('#Add_OrderProduct_UserID').val(ret.User_ID); 
	   
	  } else {
		  alert("请选择这个订单！");
		  }

   

   },    

   position:"last"  
});
		   }
	 //格式话产品状态类型
	function Fmatter_Order_Status(cellvalue, options, rowObject){
		  if(cellvalue=='0'){
			  //return "未确认下单";
			 return "<button >下单</button>";
		  }else if(cellvalue=='1'){
			  return "<button >派送</button>";
		  }else if(cellvalue=='2'){
			  return "已派送";
		  }else if(cellvalue=='3'){
			  return "已发货";
		  }else if(cellvalue=='4'){
			  return "已送货";
		  }else if(cellvalue=='5'){
			  return "已退货";
		  }
		}
		
	   function ModifyOrderProduct(Order_ID,Order_Products,name){
		var Obj=eval("[]");
	  Obj.Order_ID=Order_ID;
	  Obj.Order_Products=Order_Products;
	  ajaxHandle("../orderHandle/ModifyOrder.jsp","xml",name+"&"+readJson(Obj),backMsg) ; 
		}		
		
	   function ModifyPayment_Price(Order_ID,Payment_Price){
		var Obj=eval("[]");
	  Obj.Order_ID=Order_ID;
	  Obj.Payment_Price=Payment_Price;
	  ajaxHandle("../orderHandle/ModifyOrderMain.jsp","xml",readJson(Obj),backMsg) ; 
		}	
		
			function FmatterDel(cellvalue, options, rowObject){
			return "删除";
		}
				 //格式话产品状态类型
	function Fmatter_Order_Info(cellvalue, options, rowObject){
		
		return "<button class='SeeInfo' info='"+cellvalue+"'>查看留言</button>"
		}	
		//格式化表格删除按键
	function FmatterDel(cellvalue, options, rowObject){
			return "删除";
		}
		//删除用户
	function delOrder(Order_ID){
	var Obj=eval("[]");
	  Obj.Order_ID=Order_ID;
	  ajaxHandle("../orderHandle/delectOrder.jsp","xml",readJson(Obj),backMsg) ; 
		}
		//添加用户
  function addUser(User_ID,User_Name,User_Pwd,User_Type,UP_ID){
	  	$.ajax({
   type: "POST",
   async: false,
   dataType: "xml",
   url: "../userHandle/addUser.jsp",
   data: encodeURI("User_ID="+User_ID+"&User_Name="+User_Name+"&User_Pwd="+User_Pwd+"&User_Type="+User_Type+"&UP_ID="+UP_ID),
   success: function(xmlResponse){
    //getStart(xmlResponse);
	var statuc=$(xmlResponse).find("statuc").text();	
	if(statuc=="true"){
		AddUserMsg($(xmlResponse).find('msg').text());
		$("#list1").trigger("reloadGrid");
		}else{
		AddUserMsg($(xmlResponse).find('msg').text());
		}
 	},
		error: function(XMLHttpRequest, textStatus, errorThrown) {
                        alert("status:"+XMLHttpRequest.status+"readyState:"+XMLHttpRequest.readyState+"text:"+XMLHttpRequest.responseText);
                    },
 });
	  }
	//添加订单
  function addOrder(User_ID,Info){
	  var Obj=eval("[]");
	  Obj.User_ID=User_ID;
	  Obj.Info=Info;
	  Obj.Order_Name="main_order";
	  ajaxHandle("../orderHandle/addOrderProduct.jsp","xml",readJson(Obj),backMsg) ; 
	  }
	  
	function addOrderProduct(Order_ID,User_ID,Product_ID,Product_Num,Info){
		 var Obj=eval("[]");
	  Obj.User_ID=encodeURIComponent(User_ID);
	  Obj.Info=Info;
	  Obj.Order_ID=Order_ID;
	  Obj.Order_Products=Product_ID;
	  Obj.Product_Num=encodeURIComponent(Product_Num);
	  Obj.Order_Name="product_order";
	  ajaxHandle("../orderHandle/addOrderProduct.jsp","xml",readJson(Obj),backMsg) ; 
		}
		
	   //确认下单
	   function Sure_Order(User_ID,Order_ID){
	 var Obj=eval("[]");
	  Obj.User_ID=encodeURIComponent(User_ID);
	  Obj.Order_ID=Order_ID;
	  
	  ajaxHandle("../orderHandle/testConfirm_Order.jsp","xml",readJson(Obj),function(xmlResponse){
    //getStart(xmlResponse);
	var statuc=$(xmlResponse).find("statuc").text();	
	if(statuc=="true"){
		alert($(xmlResponse).find('msg').text());
		$("#list1").trigger("reloadGrid");
		}else{
		alert($(xmlResponse).find('msg').text());
		}
 	}) ; 	   
}		
		
 //添加用户提示
 function AddUserMsg(text){
	 
	 $( ".Add_User_Msg" ).text( text )
				.addClass( "ui-state-highlight" );
			setTimeout(function() {			
				$( ".Add_User_Msg" ).removeClass( "ui-state-highlight", 1500 );
				 $( ".Add_User_Msg" ).text("");
			}, 500 );
	 }
 function Toalert(text){
	 alert(text);
	 }
	 
function backMsg(xmlResponse){
	var statuc=$(xmlResponse).find("statuc").text();	
	if(statuc=="true"){
		
		//AddUserMsg($(xmlResponse).find('msg').text());
		$("#list1").trigger("reloadGrid");
		alert($(xmlResponse).find('msg').text());
		
		}else{
		//AddUserMsg($(xmlResponse).find('msg').text());
		alert($(xmlResponse).find('msg').text());
		}
	} 
	 
	 function initAutocomplete(){
		 	$( "#Add_Order_UserID" ).autocomplete({
			//source: "../userHandle/queryUser_Type.jsp",
			minLength: 0,
			selectedIndex:0,
			 source: function (request, response) {            
			 request.page = "1";  
			 request.rows= "100"; 
			 request.User_ID=encodeURIComponent(request.term);
			 request.User_Type="3";
	ajaxHandle("../userHandle/searchUser.jsp","json",readJson(request),response) ; 
			 },
			select: function( event, ui ) {
				//log( ui.item ?
				//	"Selected: " + ui.item.value + " aka " + ui.item.id :
				//	"Nothing selected, input was " + this.value );
				//alert(ui.item.id);
				 findDeliver(ui.item.value);
			}
		});
			
			
				 	$( "#Add_OrderProduct_UserID" ).autocomplete({
			//source: "../userHandle/queryUser_Type.jsp",
			minLength: 0,
			selectedIndex:0,
			 source: function (request, response) {            
			 request.page = "1";  
			 request.rows= "100"; 
			 request.User_ID=encodeURIComponent(request.term);
			 request.User_Type="3";
	ajaxHandle("../userHandle/searchUser.jsp","json",readJson(request),response) ; 
			 },
			select: function( event, ui ) {
				//log( ui.item ?
				//	"Selected: " + ui.item.value + " aka " + ui.item.id :
				//	"Nothing selected, input was " + this.value );
				//alert(ui.item.id);
				 findDeliver(ui.item.value);
			}
		});
					
								 	$( "#Add_OrderProduct_ProductID" ).autocomplete({
			//source: "../userHandle/queryUser_Type.jsp",
			minLength: 0,
			selectedIndex:0,
			 source: function (request, response) {            
			 request.page = "1";  
			 request.rows= "100"; 
			 request.Product_Name=encodeURIComponent(request.term);
	ajaxHandle("../productHandle/searchProduct.jsp","json",readJson(request),response) ; 
			 },
			select: function( event, ui ) {
				//log( ui.item ?
				//	"Selected: " + ui.item.value + " aka " + ui.item.id :
				//	"Nothing selected, input was " + this.value );
				//alert(ui.item.id);
				 findDeliver(ui.item.value);
			}
		});
									
									
		
		 	$( "#UPID" ).autocomplete({
			//source: "../userHandle/queryUser_Type.jsp",
			minLength: 0,
			selectedIndex:0,
			 source: function (request, response) {            
			 request.page = "1";  
			 request.rows= "100"; 
			 request.User_ID=encodeURIComponent(request.term);
			 request.User_Type="2";
	ajaxHandle("../userHandle/searchUser.jsp","json",readJson(request),response) ; 
			 },
			select: function( event, ui ) {
				//log( ui.item ?
				//	"Selected: " + ui.item.value + " aka " + ui.item.id :
				//	"Nothing selected, input was " + this.value );
				//alert(ui.item.id);
				//findOrder();
			}
		});		
			
			
		 	$( "#UserID" ).autocomplete({
			//source: "../userHandle/queryUser_Type.jsp",
			minLength: 0,
			selectedIndex:0,
			 source: function (request, response) {            
			 request.page = "1";  
			 request.rows= "100"; 
			 request.User_ID=encodeURIComponent(request.term);
			 request.User_Type="3";
	ajaxHandle("../userHandle/searchUser.jsp","json",readJson(request),response) ; 
			 },
			select: function( event, ui ) {
				//log( ui.item ?
				//	"Selected: " + ui.item.value + " aka " + ui.item.id :
				//	"Nothing selected, input was " + this.value );
				//alert(ui.item.id);
				// findOrder();
			}
		});						
			
			
		 	$( "#DeliverID" ).autocomplete({
			//source: "../userHandle/queryUser_Type.jsp",
			minLength: 0,
			selectedIndex:0,
			 source: function (request, response) {            
			 request.page = "1";  
			 request.rows= "100"; 
			 request.User_ID=encodeURIComponent(request.term);
			 request.User_Type="4";
	ajaxHandle("../userHandle/searchUser.jsp","json",readJson(request),response) ; 
			 },
			select: function( event, ui ) {
				//log( ui.item ?
				//	"Selected: " + ui.item.value + " aka " + ui.item.id :
				//	"Nothing selected, input was " + this.value );
				//alert(ui.item.id);
				// findOrder();
			}
		});						
		 }
		
	 
	function initDialog(){
		$( "#AddOrder-form" ).dialog({
			autoOpen: false,
			height:300,
			width: 300,
			modal: true,
			buttons: {
				"创建订单": function() {
					//specify($("#Dispatch_Order_ID").val(),$("#Dispatch_Deliver_ID").val());
					addOrder($("#Add_Order_UserID").val(),$("#Add_Order_Info").val());
				},
				//"取消": function() {
				//	$( this ).dialog( "close" );
				//}
			},
			"取消": function() {
				//allFields.val( "" ).removeClass( "ui-state-error" );
			}
		});
		
			$( "#AddOrderProduct-form" ).dialog({
			autoOpen: false,
			height:450,
			width: 300,
			modal: true,
			buttons: {
				"添加产品": function() {
					//specify($("#Dispatch_Order_ID").val(),$("#Dispatch_Deliver_ID").val());
	addOrderProduct($("#Add_OrderProduct_OrderID").val(),$("#Add_OrderProduct_UserID").val(),$("#Add_OrderProduct_ProductID").val(),$("#Add_OrderProduct_ProductNum").val(),$("#Add_OrderProduct_Info").val())
				},
				//"取消": function() {
				//	$( this ).dialog( "close" );
				//}
			},
			"取消": function() {
				//allFields.val( "" ).removeClass( "ui-state-error" );
			}
		});
		} 
	 
	 //初始化派送订单对话框
function initSpecifyOrderDialog(){
	
	$( "#specify-form" ).dialog({
			autoOpen: false,
			height: 500,
			width: 550,
			modal: true,
			buttons: {
				"添加": function() {
					specify($("#Dispatch_Order_ID").val(),$("#Dispatch_Deliver_ID").val());
					
				},
				//"取消": function() {
				//	$( this ).dialog( "close" );
				//}
			},
			"取消": function() {
				//allFields.val( "" ).removeClass( "ui-state-error" );
			}
		});
}
//初始化搜索订单添加时间
function initFind_Orderdatepicker(){
			var dates = $( "#Start_Order_AddTime, #End_Order_AddTime" ).datepicker({
			defaultDate: "+1w",
			changeMonth: true,
			numberOfMonths: 1,
			onSelect: function( selectedDate ) {
				var option = this.id == "Start_Order_AddTime" ? "minDate" : "maxDate",
					instance = $( this ).data( "datepicker" ),
					date = $.datepicker.parseDate(
						instance.settings.dateFormat ||
						$.datepicker._defaults.dateFormat,
						selectedDate, instance.settings );
				dates.not( this ).datepicker( "option", option, date );
			}
		});
	}
//初始化搜索送货员下拉菜单
function initFind_DeliverAutocomplete(){
		$( "#Find_Deliver_Name" ).autocomplete({
			//source: "../userHandle/queryUser_Type.jsp",
			minLength: 0,
			selectedIndex:0,
			 source: function (request, response) {            
			 request.page = "1";  
			 request.rows= "100"; 
			 request.User_Name=encodeURIComponent(request.term);
			 request.User_Type="4";
				$.ajax({
					url: "../userHandle/searchUser_Name.jsp",
					data: request,
					dataType: "json",
					success: function( data, status ) {
					
							response( data );
						
					},
					error: function() {
					
							response( [] );
						
					}
				});
			 },
			select: function( event, ui ) {
				//log( ui.item ?
				//	"Selected: " + ui.item.value + " aka " + ui.item.id :
				//	"Nothing selected, input was " + this.value );
				//alert(ui.item.id);
				 findDeliver(ui.item.value);
			}
		});
	}
//初始化查询订单，指定送货按钮 
function initfindOrder(){
			$("#find").click(
		    function(){
				//alert($("#search").serialize());
	 findOrder();
			}
		);	
			$("#Find_Deliver_Button").click(
		    function(){
				//alert($("#search").serialize());
	 findDeliver();
			}
		)
	}
	//搜索用户事件
	function findOrder(){
		/*获取select 选中的 text : 
	$("#ddlRegType").find("option:selected").text(); 
	获取select选中的 value: 
	$("#ddlRegType ").val(); 
	获取select选中的索引: 
	$("#ddlRegType ").get(0).selectedIndex; 
	设置select: 
	设置select 选中的索引： 
	$("#ddlRegType ").get(0).selectedIndex=index;//index为索引值*/
	//alert("userid="+$( "#userid").val()+"  username="+$( "#username").val()+"  usertype="+$( 			"#usertype").get(0).selectedIndex);
	var OrderID=encodeURIComponent($( "#OrderID").val());
	var OrderName=$( "#OrderName").val();
	var OrderStatus=$( "#OrderStatus").val();
	var UPID=encodeURIComponent($( "#UPID").val());
	var UserID=encodeURIComponent($( "#UserID").val());
	var DeliverID=encodeURIComponent($( "#DeliverID").val());
	var StartAddTime=$( "#Start_Order_AddTime").val();
	var EndAddTime=$( "#End_Order_AddTime").val();
$("#list1").jqGrid('setGridParam',{ url: '../orderHandle/queryMainOrder.jsp',
postData:{Order_ID:OrderID,Order_Name:OrderName,Order_Status:OrderStatus,UP_ID:UPID,User_ID:UserID,
Deliver_ID:DeliverID,Start_AddTime:StartAddTime,End_AddTime:EndAddTime},
}).trigger('reloadGrid'); 
		}

//搜索送货员函数
function findDeliver(UserName){
	var Url='../userHandle/editUser.jsp?_search=false&User_Type=4'
	if(empty(UserName)){
    UserName=encodeURIComponent($("#Find_Deliver_Name").val());
}
UserName=encodeURIComponent(UserName);
$("#songhuyuan").jqGrid('setGridParam',{ url: Url,
postData:{User_ID:UserName}
}).trigger('reloadGrid'); 
	}
		//指派送货员事件 将调用选择框
function 	specify_Event(Order_ID){
	$('#specify-form').dialog('open').children('form')[0].reset(); 
	$('#Dispatch_Order_ID').val(Order_ID);
	}

//指派送货员
function specify(Dispatch_Order_ID,Dispatch_Deliver_ID){
		$.ajax({
   type: "POST",
   async: false,
   dataType: "xml",
   url: "../orderHandle/DispatchOrder.jsp",
   data: encodeURI("Order_ID="+Dispatch_Order_ID+"&Deliver_ID="+Dispatch_Deliver_ID),
   success: function(xmlResponse){
    //getStart(xmlResponse);
	var statuc=$(xmlResponse).find("statuc").text();	
	if(statuc=="true"){
		AddUserMsg($(xmlResponse).find('msg').text());
		$("#list1").trigger("reloadGrid");
		}else{
		AddUserMsg($(xmlResponse).find('msg').text());
		}
 	},
		error: function(XMLHttpRequest, textStatus, errorThrown) {
                        alert("status:"+XMLHttpRequest.status+"readyState:"+XMLHttpRequest.readyState+"text:"+XMLHttpRequest.responseText);
                    },
 });
}

//格式指派订单送货员
function Fmatter_specify(cellvalue, options, rowObject){
		return "指定送货>";
		}

	//初始化送货员表格
   function initsonghuyuan(){
     $("#songhuyuan").jqGrid({
   	url:'../userHandle/queryUser.jsp?User_Type=4',
	datatype: "xml",
   	colNames:['送货员ID','送货员姓名','指派'],
   	colModel:[
		{name:'Deliver_ID', width:120, sortable:false},
   		{name:'User_Name',index:'Order_Total_Price', width:100 ,sortable:false},
		{name:'specify', width:75,sortable:false,formatter:Fmatter_specify},
   	],
	//scroll: true,
   	rowNum:10,
   	autowidth: true,
	autoheight:true,
   	rowList:[10,20,30],
	prmNames:{page:'page',rows:'rows',order: 'sord', search:'_search', nd:'nd', npage:null},
	//postData:{page:'page',rows:'rows', sort: 'sidx',order: 'sordsdf'},
   	pager: jQuery('#songhuyuanpager'),
   	sortname: 'User_ID',
    viewrecords: true,
    sortorder: "desc",
    caption:"指定送货员",	
	forceFit : true,
	cellEdit: true,
	cellsubmit: 'clientArray',
	afterEditCell: function (id,name,val,iRow,iCol){
	
	},
	afterSaveCell : function(rowid,name,val,iRow,iCol) {
		
	},
	loadCompele:function(){alert("compele")},
	loadError:function(){alert("error")},
	onSelectRow: function(id){    
      
   },   
	gridComplete: function() {
    	//$( "button").button();
    }, 
	//此事件在点击表格特定单元格时发生。rowid 为行ID；iCol 为列索引；cellcontent 为单元格中内容；e 点击事件对象
	onCellSelect:function(rowid,iCol,cellcontent,e){
		if(iCol==2){
			var myrow = jQuery('#songhuyuan').jqGrid('getRowData',rowid);
			$('#Dispatch_Deliver_ID').val(myrow.Deliver_ID);
			}
		},
	  
}).navGrid('#songhuyuanpager',{edit:false,add:false,del:false,search: false });
//jQuery("#list1").jqGrid('inlineNav',"#pager1");
	   }
	   
	  function encode_serialize_form(serialize){
		 var serialize = decodeURIComponent(serialize,true);
         return serialize;//encodeURI(serialize);
		  }
		  //自定义序列号表单
		  function form_serialize(expr){
			  var url="";
			  $(expr).find("[type='text']").map(function(){
									if(url!=""){
										url+=",";
										}
									url+="'"+$(this).attr("name")+"':'"+"s"+decodeURI($(this).val())+"'";
													  }
							).get();
		
			  return url;
			  }
			  
			  
			  function initShowreturnInfo(){
	$( "#Info-form" ).dialog({
			autoOpen: false,
			height: 300,
			width: 350,
			modal: true,
			buttons: {
		
			"取消": function() {
				//allFields.val( "" ).removeClass( "ui-state-error" );
				$('#Info-form').dialog('close'); 
			}
			}
		});
	}
	
	   //查看订单备注
   function initSeeOrderInfo(){
	   $('.SeeInfo').live('click', function () {
			$('#ShowreturnInfo').empty(); 
			try
        {
      	var obj = JSON.parse($(this).attr("info")); 
		var info=obj.returned_goods_info;
		for(var i=0;i<info.length;i++){
		$('#ShowreturnInfo').append("<span style=' margin:0'>"+info[i].time+":</span>"+"<span style=' margin:0'><br>"+info[i].title+":</span><br>"+"<p style=' margin:0'>  "+info[i].info+"</p>");
		}
			$('#Info-form').dialog('open'); 
         }
        catch (e)
        {
             alert('没有留言');
         }

	
			
 			 }
		);
	   }

	   
// JavaScript Document